#ifndef __RESULTSDIALOGACTION_H
#define __RESULTSDIALOGACTION_H

#include <gtkmm/dialog.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/alignment.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treestore.h>
#include <gtkmm/uimanager.h>
#include <gtkmm/actiongroup.h>
#include <gtkmm/messagedialog.h>
#include <iostream>
#include <cstring>
#include "results.h"
#include "viewer.h"

class viewer;

class resultsDialogAction
{
	public:
		resultsDialogAction(viewer* v);
		void createResultsDialog();
		void addRow(results* res, int width);
		void showResultsDialog();

	private:
		class infoTree : public Gtk::TreeModel::ColumnRecord
		{
			public:
			   infoTree()
			   { add(field); add(value); }
			   Gtk::TreeModelColumn<Glib::ustring> field;
			   Gtk::TreeModelColumn<Glib::ustring> value;
		};

		infoTree infoT;
		Gtk::ScrolledWindow scrollInfo;
		Gtk::TreeView tree;
		Glib::RefPtr<Gtk::TreeStore> refTree;
		Gtk::Dialog resultsDialog;
		Gtk::VBox infoBox;
		Gtk::Button button;
		Gtk::Alignment buttonAlignment;
		Gtk::TreeModel::iterator iter;
		Glib::RefPtr<Gtk::UIManager> rowManager;
		viewer* v;
		int executions;

		//Signal handlers
		virtual void on_clear_tree_clicked();
		virtual bool on_row_pressed(GdkEvent* e);
		virtual void on_remove_row();
};

#endif